﻿
Imports System.IO
Imports xmlctrl
Imports xhtmlctrl

Public Class autowrappre
    Inherits pre

#If RETIRED Then
    Public Const className As String = "wc_wr"

    Private Sub initial(ByVal inlineStyle As inlineStyle)
        assert(Not inlineStyle Is Nothing, "inlineStyle is nothing.")
        [class] = className
        inlineStyle.addstyle("autowrap", "." + className + "{white-space:pre-wrap;" + _
                                                            "white-space:-moz-pre-wrap;" + _
                                                            "white-space:-pre-wrap;" + _
                                                            "white-space:-o-pre-wrap;" + _
                                                            "word-wrap:break-word;}")
    End Sub

    Public Sub New(ByVal inlineStyle As inlineStyle, Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
        initial(inlineStyle)
    End Sub

    Public Sub New(ByVal page As xhtmlpage, Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
        assert(Not page Is Nothing, "page is nothing.")
        initial(page.inlineStyle())
    End Sub
#End If

    Public Sub New(ByVal inlineStyle As inlineStyle, Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
        autowrap.invoke(inlineStyle, Me)
    End Sub

    Public Sub New(ByVal page As xhtmlpage, Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff)
        autowrap.invoke(page, Me)
    End Sub

    Protected Overrides Function render(ByVal compress As Boolean) As Boolean
        autowrap.setclass(Me)
        Return MyBase.render(compress)
    End Function

End Class
